package com.hedl.studyandjava8.java_new.method_reference.entity;

import com.hedl.studyandjava8.java_new.method_reference.service.Supplier;

/**
 * @author Big Watermelon
 * @description
 * @date 2024/02/13/18:59
 */
public class Car {
    //Supplier是jdk1.8的接口，这里和lamda一起使用了
    public static Car create(final Supplier<Car> supplier){
        return supplier.get();
    }

    public static void collide(final Car car){
        System.out.println("Collided "+car.toString());
    }

    public void follow(final Car another){
        System.out.println("Following the "+ another.toString());
    }

    public void repair(){
        System.out.println("Repaired "+this.toString());
    }

}
